package com.jrx.anytxn.transaction.job.dailyAccount.step;

import com.jrx.anytxn.transaction.entity.BtDailyAccountList;
import com.jrx.anytxn.transaction.mapper.ext.ExtBtDailyAccountListMapper;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.batch.item.ItemWriter;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 日终T24核心汇总记账初始化数据保存入库
 *
 * @Author yhy
 * @Date 2023/4/29 9:20
 */
@Service
public class DailyAccountInitWriter implements ItemWriter<BtDailyAccountList> {

    @Resource
    private ExtBtDailyAccountListMapper extBtDailyAccountListMapper;

    @Override
    public void write(List<? extends BtDailyAccountList> items) throws Exception {
        if(CollectionUtils.isNotEmpty(items)){
            for (BtDailyAccountList item : items){
                extBtDailyAccountListMapper.insert(item);
            }
        }
    }
}
